<?php // -*-coding:utf-8; mode:php-mode;-*-
namespace dao;

use framework\data\pdo;

class UserDao {
	/**
	 * 
	 * @var framework\data\pdo\PDOHelper
	 */
	private $pdoHelper;
	private $pdo;

	/** 
	 * 构造函数
	 * 
	 * @return 
	 */
	public function __construct()
	{
		$this->pdo = pdo\PDOManager::getInstance("default");

		$this->pdoHelper = new pdo\PDOHelper("entity\\User");
        $this->pdoHelper->setPdo($this->pdo);
	}

	/** 
	 * 获取用户信息，从匹配的用户名中
	 * 
	 * @param String $userName 
	 * 
	 * @return entity\User
	 */
	public function fetchUserByLoginName($loginName)
	{
		return $this->pdoHelper->fetchEntityByLoginName($loginName);
	}
	
	/**
	 * 根据ID获取用户
	 * @param entity\User $id
	 */
	public function load($id)
	{
		return $this->pdoHelper->load(1);
	}
}